const KEY = require("../../config/Key");
module.exports = {
    jwtOptions: {
        secret: KEY,
        algorithms: ['HS256'],
        getToken: req => {
            return req.headers.token
        }
    },
    unlessObject: {
        ext: ['ico', 'jpg', 'html', 'css', 'js', 'png'],
        method: ['OPTIONS'],
        path: [
            {url: '/admin', methods: ['GET']},
            {url: '/api/login', methods: ['POST', "GET"]}, // login api post 请求 无需权限
            {url: '/api/register', methods: ['POST']}, // register api post 请求 无需权限
            {url: '/test/login', methods: ['GET']},
            {url: '/s', methods: ['GET']}
        ],
        custom: req => {
            if (req.headers.token === 'miniweixin') {
                console.log('miniweixin')
                return true
            }
        }
    }
}
